package gizwits.overseaair.way.controldevice;

import java.util.HashMap;
import java.util.Map;

import com.alibaba.fastjson.JSONObject;

import gizwits.kit.Address;
import gizwits.kit.HttpKit;

public class control {
	public static final String uri = "/api/device/control";
	
	/**
  		"deviceNumber",
		"factTemp",
		"setTemp",
		"lock",
		"swing",
		"power",
		"mode",
		"wind",
		"other",
	 * @param args
	 */
	
	public static void main(String[] args) {
		Map<String, Object> params = new HashMap<>();
//		params.put("userId", "f5ae5438af4644169ae74ba776b78852");
		params.put("userId", "187f57e6b335412094e08cb5d02d275f");
		//f1fb53752dff46008795777775da7d5d  45fd96645d8443089f5d5f6e401fe8d2  c1322338506044fe91996ea16c59c657
		//params.put("groupId", "2301194c80f24f569dcd1f5ebeab6423");
		//={"id":"485","wind":"low","mode":"cool","power":"y","swing":"n","setTemp":18}
		//{"id":485,"mode":"cool","power":"y","setTemp":"18","swing":"n","wind":"low"}  userId=dfbe7fd125174baab19b587b1d94ecf3
		JSONObject control = new JSONObject();
		control.put("id", 22269);
		control.put("setTemp", "25");
//		control.put("lock", "mode,cool,heat,wind,remote");
		control.put("lock", "mode");
//		control.put("lock", "");
		control.put("swing", "n");
		control.put("power", "y");
		control.put("mode", "cool");
		control.put("wind", "low");
		control.put("modeLockValue", "cool");
		control.put("windLockValue", "low");
		control.put("coolLockValue", 22);
		control.put("heatLockValue", 24);
		params.put("control", control);
		JSONObject operation = new JSONObject();
		operation.put("setTemp", 28);
		params.put("operation", operation);
		System.out.println(new JSONObject(params));
		HttpKit.post(Address.air2+uri, params);
		//={"id":"579","wind":"low","mode":"fan","power":"y","swing":"n","lock":"mode,mode","setTemp":21}  
		//userId=dfbe7fd125174baab19b587b1d94ecf3 
	}
	
}
